print("ВВедите скобочную посдедователььность")
b = input()
b1 = ""
for char in b:
    if char == "(":
        b1 += char
    if char == ")":
        if len(b1)>0:
            if b1[len(b1)-1] == "(":
                b1 = b1[:-1]
    if char == "[":
        b1 += char
    if char == "]":
        if len(b1)>0:
            if b1[len(b1)-1] == "[":
                b1 = b1[:-1]
    if char == "<":
        b1 += char
    if char == ">":
        if len(b1)>0:
            if b1[len(b1)-1] == "<":
                b1 = b1[:-1]
    if char == "{":
        b1 += char
    if char == "}":
        if len(b1)>0:
            if b1[len(b1)-1] == "{":
                b1 = b1[:-1]
    print(b1)
if len(b1)==0:
    print("True")
else:
    print("False")
